using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IGlobalist.Cms.Bll;
using IGlobalist.Cms.Model;
using IGlobalist.Cms.Common;

namespace IGlobalist.Cms.Admin
{
    public partial class RoleManagement : AdminBasePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {


                IList<ICmsClass> cList = ClassController.GetClassListByClassTypeID((short)CmsObjectType.Role);
                ucClassList.DataSource = cList;
                ucClassList.DataBind();
                ucActionBar.ObjectTypeCurrent = CmsObjectType.Role;
                ucActionBarBottom.ObjectTypeCurrent = CmsObjectType.Role;
            }

            ucClassList.TreeNodeClick += ucRoleList.DoBindGVRole;
            ucClassList.TreeNodeClick += ucActionBar.DoViewClick;
            ucClassList.TreeNodeClick += ucActionBarBottom.DoViewClick;
            ucClassList.TreeNodeClick += ucRoleList.DoShow;
            ucClassList.TreeNodeClick += HiddenInfo;

            ucRoleList.EventDoBindRole += ucRoleAddEdit.DoBindRoleDetail;
            ucRoleList.EventDoBindRole += ucRoleAddEdit.DoShow;
            ucRoleList.EventDoBindRole += ucActionBar.DoEditClassClick;
            ucRoleList.EventDoBindRole += ucActionBarBottom.DoEditClassClick;
            ucRoleList.EventDoBindRole += ucRoleList.DoHidden;

            ucRoleList.DisplayForm += ucRoleList.DoShow;
            ucRoleList.DisplayForm += ucRoleAddEdit.DoHidden;

            ucActionBar.CopyButtonClick += ucRoleAddEdit.DoDuplicate;
            ucActionBarBottom.CopyButtonClick += ucRoleAddEdit.DoDuplicate;
            ucActionBar.SaveButtonClick += ucRoleAddEdit.DoInsertRole;
            ucActionBarBottom.SaveButtonClick += ucRoleAddEdit.DoInsertRole;

            ucActionBar.NewButtonClick += ucRoleAddEdit.DoNew;
            ucActionBar.NewButtonClick += HiddenInfo;
            ucActionBar.NewButtonClick += ucRoleAddEdit.DoShow;
            ucActionBar.NewButtonClick += ucRoleList.DoHidden;
            ucActionBarBottom.NewButtonClick += ucRoleAddEdit.DoNew;
            ucActionBarBottom.NewButtonClick += ucRoleAddEdit.DoShow;
            ucActionBarBottom.NewButtonClick += ucRoleList.DoHidden;
            ucActionBarBottom.NewButtonClick += HiddenInfo;
            ucActionBarBottom.NewButtonClick += ucActionBar.DoEditClassClick;
            ucActionBar.NewButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBarBottom.NewButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBar.NewButtonClick += ucActionBar.DoEditClassClick;


            ucRoleAddEdit.SaveRole += ucRoleAddEdit.DoHidden;
            ucRoleAddEdit.SaveRole += ucRoleList.DoReLoadBind;
            ucRoleAddEdit.SaveRole += ucRoleList.DoShow;
            ucRoleAddEdit.SaveRole += ucActionBar.DoViewClick;
            ucRoleAddEdit.SaveRole += ucActionBarBottom.DoViewClick;
            //ucRoleAddEdit.EventReloadList += ucRoleList.DoReLoadBind;
            //ucRoleAddEdit.EventReloadList += ucRoleList.DoShow;
            //ucRoleAddEdit.EventReloadList += ucRoleAddEdit.DoHidden;
            //ucRoleAddEdit.EventIsNotSuccess += ucActionBar.DoSaveErrorClick;
        }
        public void HiddenInfo(object sender, EventArgs e)
        {
            pnlInfo.Visible = false;
        }
    }
}
